package com.canaan.business.common.enums.productBom;

import com.canaan.common.utils.StringUtils;

/**
 * 物料BOM状态枚举
 */
public enum ProductTypeEnum {

    /*
    原料
     */
    ROW_PRODUCT("1", "原料"),

    /*
    半成品
     */
    SEMI_FINISHED("2", "半成品"),
    /*
    成品
     */
    FINISHED("3", "成品");

    private final String code;
    private final String message;

    ProductTypeEnum(String code, String info)
    {
        this.code = code;
        this.message = info;
    }

    public String getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }

    public static String getMessageByCode(String code){
        for(ProductTypeEnum inspectionStatusEnum: ProductTypeEnum.values()){
            if(StringUtils.isEmpty(code)){
                return null;
            }
            if(code.equals(inspectionStatusEnum.code)){
                return inspectionStatusEnum.message;
            }
        }
        return null;
    }
    public static String getCodeByMessage(String message){
        for(ProductTypeEnum inspectionStatusEnum: ProductTypeEnum.values()){
            if(StringUtils.isEmpty(message)){
                return null;
            }
            if(message.equals(inspectionStatusEnum.message)){
                return inspectionStatusEnum.code;
            }
        }
        return null;
    }
}
